package interpreter.bytecodes;

import interpreter.VirtualMachine;
import java.util.NoSuchElementException;
import java.util.Vector;

/**
 *
 * @author Kristofer Selbekk
 */
public class LabelByteCode extends ByteCode {

    private String id; // May or may not be used

    /**
     * Initializes the byte code with no arguments
     */
    public void init( Vector<String> args ) {
        try {
            id = args.get(0);
        } catch( NumberFormatException nfe ) {
            // If bad format
            System.out.println("Bad format!");
            System.exit(-1);
        } catch( NoSuchElementException nse ) {
            // If empty argument
            System.out.println("Empty vector!");
            System.exit(-1);
        } catch( NullPointerException npe ) {
            // If argument missing
            System.out.println("Argument given = null.");
            System.exit(-1);
        }
    }

    /**
     * Action: Do nothing - act as anchor
     *
     * @param rt the Virtual Machine reference
     */
    public void exec( VirtualMachine rt ) {
        // When executed, do nothing
    }

    public Object getArgs() {
        return id;
    }
}